
************************************
*Numeric Export disabled
local TEX ""
local TEXON 1 //Change "0" to "1" to enable exporting numeric results to .txt files
if !`TEXON' local TEX "*"
*Also need to install texresults2
*ssc install texresults2
************************************


*********************************************************************
*Appendix 10.1 - Correlated Measurement Error:
*Evidence that question wording differences coould produce "true"
*differences in responses that are correlated across income groups
*********************************************************************

*************************************
*Make sure working directory is set
*************************************

use "Enns_SociologicalScience_Reproduction\DS1_0.dta", clear

list ID8102 YEAR QuestionText if strpos(lower(QuestionText), "make it a criminal offense")
list ID8102 YEAR QuestionText if strpos(lower(QuestionText), "collected information about")

	*Identify relevant row in Gilens data 
    gen match = strpos(lower(QuestionText), "make it a criminal offense") > 0

quietly {
    summarize pred10_sw if match == 1, meanonly
	local crim_offpriv_vio_10th = r(mean)
	summarize pred50_sw if match == 1, meanonly
	local crim_offpriv_vio_50th = r(mean)
	summarize pred90_sw if match == 1, meanonly
    local crim_offpriv_vio_90th = r(mean)
	}
drop match
	
	*Identify relevant row in Gilens data 
    gen match = strpos(lower(QuestionText), "collected information about") > 0

quietly {
    summarize pred10_sw if match == 1, meanonly
	local out_buspriv_vio_10th = r(mean)
	summarize pred50_sw if match == 1, meanonly
	local out_buspriv_vio_50th = r(mean)
	summarize pred90_sw if match == 1, meanonly
    local out_buspriv_vio_90th = r(mean)
	}

di `crim_offpriv_vio_10th' `crim_offpriv_vio_50th' `crim_offpriv_vio_90th'
di `out_buspriv_vio_10th' `out_buspriv_vio_50th' `out_buspriv_vio_90th'

*Expectation is less support for putting out of business, because more narrow and punitive outcome
local difprivacylow = 100*(`crim_offpriv_vio_10th'-`out_buspriv_vio_10th')
local difprivacymid = 100*(`crim_offpriv_vio_50th'-`out_buspriv_vio_50th')
local difprivacyhigh = 100*(`crim_offpriv_vio_90th'-`out_buspriv_vio_90th')
di `difprivacylow', `difprivacymid', `difprivacyhigh'
drop match
			 
`TEX'texresults2 using TxtFiles_NumericalResults\difquestwording.txt, texmacro(difprivacylow) result(`difprivacylow') round(0) replace //
`TEX'texresults2 using TxtFiles_NumericalResults\difquestwording.txt, texmacro(difprivacymid) result(`difprivacymid') round(0) append //
`TEX'texresults2 using TxtFiles_NumericalResults\difquestwording.txt, texmacro(difprivacyhigh) result(`difprivacyhigh') round(0) append //
